package itsm.isperp.report.echarts.data.query;

import itsm.isperp.framework.core.context.ContextHolder;
import itsm.isperp.framework.web.request.JqGridRequest;
import itsm.isperp.report.echarts.data.Query;

import java.util.List;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.github.abel533.echarts.data.PieData;

/**
 * 
 * 饼图数据
 * 
 * @author lizx
 * @date 2015-8-21
 * @since 1.0
 * 
 */
@Component
public class PieDataQuery implements Query {

	public static List<PieData> query(JqGridRequest req) {
		JdbcTemplate jdbcTemplate = ContextHolder.getSpringBean("jdbcTemplate");
		String sql = req.getSql();
		List<PieData> list = jdbcTemplate.query(sql, new PieDataRowMapper());
		return list;
	}
}
